package vno.fux.move
{
	import flash.utils.ByteArray;
	
	import vno.sci.mapEditor.BuildingInfo;
	public class MoveSystem
	{
		private static var instance:MoveSystem;
		private var _buildingAccessInfos:Object;				
		public function MoveSystem(pvt:PrivateClass, data_:ByteArray)
		{
			_buildingAccessInfos = BuildingInfo.markerToAssoc(data_);
		}
		public function get buildingAccessInfos():Object
		{
			return _buildingAccessInfos;
		}
		public function find(key_:String):BuildingInfo
		{
			for each(var vector:Vector.<BuildingInfo> in _buildingAccessInfos)
			{
				for each(var info:BuildingInfo in vector)
				{
					if(info.s==key_)
					{
						return info;
					}
				}
			}
			return null;
		}
		public static function init(data_:ByteArray):void
		{
			if(MoveSystem.instance)
			{
				throw new Error("You can't init the MoveSystem twice!")
			}
			MoveSystem.instance = new MoveSystem(new PrivateClass, data_);
		}
		
		public static function getInstance():MoveSystem
		{
			return MoveSystem.instance;
		}

	}
}

class PrivateClass
{
	public function PrivateClass()
	{
	}
}